import time
from selenium.webdriver.common.by import By
from common.base import Base
from common.functions import open_browser


class LoginPage(Base):
    login_url = 'http://139.129.26.163/user.php'

    def username(self, username):
        self.find_element((By.NAME, "username")).send_keys(username)

    def password(self, password):
        self.find_element((By.NAME, "password")).send_keys(password)

    def login(self):
        self.click((By.CLASS_NAME, "us_Submit"))


if __name__ == '__main__':
    browser = open_browser()
    login = LoginPage(browser)
    login.get("http://139.129.26.163/user.php")
    time.sleep(2)
    login.username("yuedong123")
    login.password("123456")
    login.login()

